home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 2.5 KB | 102 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWSUSink.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSUSINK_H
- #define FWSUSINK_H
-
- #ifndef FWASINKS_H
- #include "FWASinks.h"
- #endif
-
- #ifndef FWSUBUFF_H
- #include "FWSUBuff.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODStorageUnit_xh
- #include <StorageU.xh>
- #endif
-
- #ifndef SOM_ODStorageUnitView_xh
- #include <SUView.xh>
- #endif
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- //========================================================================================
- // •• CLASS FW_CStorageUnitSink
- //========================================================================================
-
- class FW_CLASS_ATTR FW_CStorageUnitSink : public FW_CRandomAccessSink
- {
- public:
-
- virtual ~ FW_CStorageUnitSink();
-
- FW_CStorageUnitSink(ODStorageUnitView* storageUnitView);
- // Create a sink attached to the storage unit view.
- // The sink does not assume ownership of the view.
-
- FW_CStorageUnitSink(ODStorageUnit* storageUnit, ODPropertyName propertyName, ODValueType valueType);
- // Create a sink attached to the give (storageUnit, propertyName, valueType).
-
- ODStorageUnitView* GetStorageUnitView() const;
-
- public:
-
- // ----- Random Access Sink Protocol
-
- virtual void Read(void* destination, long count);
- const void* ReadPeek(long& availableReadBytes);
- void ReadPeekAdvance(long bytesRead);
-
- virtual long GetWritableBytes() const;
- virtual void Write(const void* source, long count);
- void* WritePeek(long& availableWriteBytes);
- void WritePeekAdvance(long bytesWritten);
-
- virtual long GetLength() const;
- virtual void SetLength(long length);
- virtual long GetPosition() const;
- virtual void SetPosition(long position);
-
- public:
-
- // ----- New API
-
- void Flush(); // flush buffer to disk
-
- private:
- ODStorageUnitView* fStorageUnitView;
- FW_Boolean fOwnsView;
-
- FW_CStorageUnitBuffer fBuffer; // buffer for optimized reading/writing
-
- private:
- FW_CStorageUnitSink(const FW_CStorageUnitSink& sink);
- // Copying not allowed
-
- FW_CStorageUnitSink& operator=(const FW_CStorageUnitSink& sink);
- // Copying not allowed
-
- void PrivAcquire();
-
- void PrivDoRead(void* destination, long count);
- void PrivDoWrite(const void* source, long count);
- };
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export off
- #endif
-
- #endif
-